import React, { useEffect } from 'react'
import TodoHeader from './TodoHeader/TodoHeader'
import TodoMain from './TodoMain/TodoMain'
import TodoFooter from './TodoFooter/TodoFooter'
import './TodoList.css'
import { useDispatch } from 'react-redux'
import { asyncinittodos } from '../../store/modules/todos'
export default function TodoList() {
    let dispatch = useDispatch();
    useEffect(() => {
        //基本的数据请求(利用仓库中的dispatch进行分发这个异步任务)
        dispatch(asyncinittodos())
    }, [])
    return (
        <div className="todo-container">
            <div className="todo-wrap">
                <TodoHeader />
                <TodoMain />
                <TodoFooter />
            </div>
        </div>
    )
}
